<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="__STATIC__/js/jquery.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <script src="__STATIC__/bootstrap-table/js/bootstrap-table.js"></script>
    <script src="__STATIC__/bootstrap-table/js/bootstrap-table-zh-CN.min.js"></script>
    <script src="__STATIC__/bootstrap-table/js/dropdown.js"></script>
    <link rel="stylesheet" href="__STATIC__/bootstrap-table/css/bootstrap-table.min.css">
    <link rel="stylesheet" href="__STATIC__/bootstrap-table/css/bootstrap.css">
    <script type="text/javascript" src="__STATIC__/x-admin/js/xadmin.js"></script>
    <link rel="stylesheet" href="__STATIC__/x-admin/css/font.css">
    <link rel="stylesheet" href="__STATIC__/x-admin/css/xadmin.css">
    <script src="__STATIC__/js/common.js"></script>
</head>
<body>
<form class="layui-form" style="width: 30%" onsubmit="return false" id="update">
    <br>
    <input type="text" value="{$id.parent_id}"  name="parent_id" hidden>
    <div class="layui-form-item">
        <label class="layui-form-label">姓名</label>
        <div class="layui-input-block">
            <input type="text" name="name" required  lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">设备id</label>
        <div class="layui-input-block">
            <input type="text"  name="equipment_id" required  lay-verify="required" placeholder="请输入设备id" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">生日</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" id="test1"  name="birthday">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">头像</label>
        <div class="layui-input-block">
            <input type="text"  name="img" hidden id="img">
            <button class="layui-btn" id="photo">上传图片</button>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <input type="radio" name="sex" value="1" title="男" checked>
        <input type="radio" name="sex" value="2" title="女">

    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">身高</label>
        <div class="layui-input-block">
            <input type="text" name="height" required  lay-verify="required" placeholder="请输入身高" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">体重</label>
        <div class="layui-input-block">
            <input type="text" name="weight" required  lay-verify="required" placeholder="请输入体重" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">血压</label>
        <div class="layui-input-block">
            <input type="text" name="blood_pressure" required  lay-verify="required" placeholder="请输入血压" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">先天病史</label>
        <div class="layui-input-block">
            <input type="text" name="congenital_history" required  lay-verify="required" placeholder="请输入先天病史" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">爱好运动</label>
        <div class="layui-input-block">
            <input type="text"  name="hobby_sports" required  lay-verify="required" placeholder="请输入爱好运动" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">紧急联系电话</label>
        <div class="layui-input-block">
            <input type="text" name="sos_phone" required  lay-verify="required" placeholder="请输入紧急联系电话" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">学籍号</label>
        <div class="layui-input-block">
            <input type="text" name="stu_num" required  lay-verify="required" placeholder="请输入孩子的学籍号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo" id="up">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</body>
</html>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#test1' //指定元素
        });
    });
</script>
<script>
    $("#up").click(function(){
        $.ajax({
            url:"{:url('/parents/childrensAdd')}",
            type:"post",
            data:$("#update").serialize(),
            dataType:"json",
            success:function(res){
                if(res.code){
                    layer.msg(res.msg,{icon:1,time:2000},function(){
                        window.location.reload();
                    });
                }else{
                    layer.msg(res.msg,{icon:5,time:2000});
                }
            }
        })
    })
</script>